<?php
/**
 * NOTICE OF LICENSE
 *
 * This source file is subject to the  Academic Free License (AFL 3.0)
 * that is available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to support@zprofess.com so we can send you a copy immediately.
 *
 * @category   	Prestashop module
 * @package		Help Desk
 * @version 	1.0
 * @author 		Kurosaki <kurosaki@zprofess.com>
 * @copyright   Copyright (c) 2012 ZPROFESS. (http://zprofess.com)
 * @license    	http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

include_once(dirname(__FILE__)."/classes/ZratingObject.php");
include_once(dirname(__FILE__)."/ZadminRatingListEmail.php");

require_once(_PS_MODULE_DIR_.'zhelpdesk/lib/zprofess/ZhelpdeskadminTab.php');
class ZadminStatisticRating extends ZhelpdeskadminTab
{
	/**
	 * 
	 * Construct 
	 */
	public function __construct()
	{
		global $cookie;
		$this->table = 'zhelpdesk_ticket_rating';
	 	$this->className = 'ZratingObject';
	 	$this->lang = true;
	 	$this->view = true;
		$this->_select = 'COUNT(c.id_zhelpdesk_ticket_rating) as count';
		$this->fieldsDisplay = array(
			'id_zhelpdesk_ticket_rating' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30),
			'rating' => array('title' => $this->l('Name'), 'width' => 100),
			'description' => array('title' => $this->l('Description'), 'width' => 400, 'maxlength' => 90, 'orderby' => false),
			'count' => array('title' => $this->l('Number Rating'), 'width' => 100,'havingFilter' => true),
			'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false),
		);
//		$this->_where = 'AND c.id_zhelpdesk_ticket_rating!=NULL';
		$this->_group = 'GROUP BY c.id_zhelpdesk_ticket_rating';
		$this->_having = 'count > 0';
		$this->_join = 'LEFT  JOIN '._DB_PREFIX_.'zhelpdesk_ticket_content c on (a.id_zhelpdesk_ticket_rating=c.id_zhelpdesk_ticket_rating)';
		parent::__construct();
	}	
}
